#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <ctime>
#include <fstream>

using namespace std;

const int maxn = 100005;
int x[maxn], y[maxn];
int mtx[3][3], mtx2[3][3];

void multi() {
    int tmp[3][3];
    memset(tmp, 0, sizeof(tmp));
    int i, j, k;
    for (i = 0; i < 3; ++i) {
        for (j = 0; j < 3; ++j) {
            for (k = 0; k < 3; ++k) {
                tmp[i][j] += mtx[i][k] * mtx2[k][j];
            }
        }
    }
    memcpy(mtx, tmp, sizeof(tmp));
}

int main() {
    int i, j, k, n, m, od, p, q, l;
    while (cin >> n) {
        memset(mtx, 0, sizeof(mtx));
        for (i = 0; i < 3; ++i) {
            mtx[i][i] = 1;
        }
        for (i = 0; i < n; ++i) {
            cin >> x[i] >> y[i];
        }
        cin >> m;
        while (m--) {
            cin >> od;
            memset(mtx2, 0, sizeof(mtx2));
            for (i = 0; i < 3; ++i) mtx2[i][i] = 1;
            if ( od == 1 ) {
                cin >> p >> q;
                mtx2[2][0] = p;
                mtx2[2][1] = q;
            } else if ( od == 2 ) {
                cin >> l;
                mtx2[0][0] = mtx2[1][1] = l;
            } else if ( od == 3 ) {
                mtx2[1][1] = -1;
            } else {
                mtx2[0][0] = -1;
            }
            multi();
        }
        for (i = 0; i < n; ++i) {
            cout << x[i] * mtx[0][0] + y[i] * mtx[1][0] + 1 * mtx[2][0] << " "
                 << x[i] * mtx[0][1] + y[i] * mtx[1][1] + 1 * mtx[2][1] << endl;
        }
    }
    return 0;
}